<?php

/**
 * formulairedef form base class.
 *
 * @method formulairedef getObject() Returns the current form's model object
 *
 * @package    forumCDE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseformulairedefForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                    => new sfWidgetFormInputHidden(),
      'code'                  => new sfWidgetFormInputText(),
      'description'           => new sfWidgetFormInputText(),
      'type_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'add_empty' => true)),
      'workflow_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('workflow'), 'add_empty' => true)),
      'xtable'                => new sfWidgetFormInputText(),
      'moduleName'            => new sfWidgetFormInputText(),
      'commentaire'           => new sfWidgetFormTextarea(),
      'delaistandar'          => new sfWidgetFormInputText(),
      'shortcut'              => new sfWidgetFormInputText(),
      'onclosescript'         => new sfWidgetFormTextarea(),
      'onclosefunctscript'    => new sfWidgetFormTextarea(),
      'scriptdeterminationwf' => new sfWidgetFormTextarea(),
      'fichiersignature'      => new sfWidgetFormInputText(),
      'activeStatus'          => new sfWidgetFormInputText(),
      'created_at'            => new sfWidgetFormDateTime(),
      'updated_at'            => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                    => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'code'                  => new sfValidatorString(array('max_length' => 20, 'required' => false)),
      'description'           => new sfValidatorString(array('max_length' => 100)),
      'type_id'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'required' => false)),
      'workflow_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('workflow'), 'required' => false)),
      'xtable'                => new sfValidatorString(array('max_length' => 80)),
      'moduleName'            => new sfValidatorString(array('max_length' => 100)),
      'commentaire'           => new sfValidatorString(array('required' => false)),
      'delaistandar'          => new sfValidatorInteger(array('required' => false)),
      'shortcut'              => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'onclosescript'         => new sfValidatorString(array('required' => false)),
      'onclosefunctscript'    => new sfValidatorString(array('required' => false)),
      'scriptdeterminationwf' => new sfValidatorString(array('required' => false)),
      'fichiersignature'      => new sfValidatorInteger(array('required' => false)),
      'activeStatus'          => new sfValidatorInteger(),
      'created_at'            => new sfValidatorDateTime(),
      'updated_at'            => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('formulairedef[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'formulairedef';
  }

}
